<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<style>
    .active{
        color: red;
    }
    .line{
        font-size: 40px;
    }
</style>
<body>
    <div id="app">
        {{message}}
        <h2 class="active">这是正常的class</h2>
        <h2 :class="active">这是v-bind控制的class</h2>
        <h2 :class="{active:isActive,line:isLine}">{{message}}</h2>
        <button v-on:click="btnClick">通过变量决定class  active属性</button>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                 message:'我是你爹!' ,
                 active:'active',
                 isActive:false,
                 isLine:true,
            },
            methods: {
                btnClick:function(){
                    this.isActive=!this.isActive;
                }
            }
        });
    </script>
</body>

</html>